<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>阶乘和</title>
</head>
<body>
    <!-- 求1 + 2！ + 3！ + 4！....+20!的值 -->
</body>
<script>
    (function () {
        var n = 1;
        var sum = 0;
        for (var i = 1; i <= 20; i++) {
            n *= i;
            sum += n;
        }
        console.log(sum);
        //i == 1 => 1
        //i == 2 => 3 
        //i == 3 => 9
        //i == 4 => 24 + 9 = 33





    })();
</script>
</html>